package com.horsen.service.edu.controller.web;


import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.horsen.common.util.R;
import com.horsen.service.edu.controller.BaseController;
import com.horsen.service.edu.model.VO.SubjectVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 科目 控制器
 *
 * @author Horsen
 */
@Api(tags = "科目管理")
@ApiSupport(order = 3)
@Slf4j
@RestController("WebSubject")
@RequestMapping("/web/edu/subjects")
public class SubjectController extends BaseController {

    @ApiOperation("获取科目树形列表")
    @Cacheable(key = "'webQuerySubjects'", value = "treeList")
    @GetMapping("/")
    public R getTreeList() {
        List<SubjectVO> treeList = subjectService.getTreeList();
        return R.ok().setData("items", treeList);
    }
}

